def cal(a, q, n):
    sum = a
    for i in range(n - 1):
        a *= q
        sum += a
    return sum
a, q, n = map(int, input('请依次输入a数列首项，q数列的比值，n等比数列的长度').split())
print('结果为', cal(a, q, n))